﻿using System;
using HAVNet.Intros.Parsing;


namespace HAVNet.Intros.ParseTree
{
    public class NodeTerminalSymbol : NodeSymbol
    {
        public readonly Token val = null;

        public NodeTerminalSymbol (NodeSymbol parent, Token val)
            : base (parent)
        {
            this.val = val;
        }

        public override void add (NodeSymbol treeNode)
        {
            throw new Exception ("No se pueden agregar hijos a una hoja");
        }

        public override void remove (NodeSymbol treeNode)
        {
            throw new Exception ("No se puede remover nada de una hoja");
        }

        public override bool visit (SymbolNodeVisitFunction f, int depth)
        {
            return f (this, depth);
        }

        public override string ToString ()
        {
            return val.val;
        }
    }
}
